
function main(count, inputss, L, target_str) {
  //每个层级上对应字符串的出现次数
  let node_info = {};

  let i = 0;
  while (true) {
    if (i >= count) {
      break;
    } else {
      let inputs = inputss[i].split("/");
      //细节要注意从1开始
      for (let j = 1; j < inputs.length; j++) {
        if (node_info.hasOwnProperty(j)) {
          if (node_info[j].hasOwnProperty(inputs[j])) {
            node_info[j][inputs[j]] += 1;
          } else {
            node_info[j][inputs[j]] = 1;
          }
        } else {
          let tmp_map = {};
          node_info[j] = tmp_map;
          node_info[j][inputs[j]] = 1;
        }
      }
    }
    i += 1;
  }

  let output_count = 0;

  if (node_info.hasOwnProperty(L)) {
    if (node_info[L].hasOwnProperty(target_str)) {
      output_count = node_info[L][target_str];
    }
  }
  console.log(node_info)
  console.log(output_count);
}

function countFZ(num, arr, level, targetStr) {
  let map = new Map()
  let i = 0
  while (i<num) {
    const splits = arr[i++].split('/')
    for (let j = 1; j < splits.length; j++) {
      const key = splits[j]
      const obj = map.get(j)
      if (!obj) {
        map.set(j, { [key]: 1 })
      } else {
        if (obj.hasOwnProperty(key)) {
          map.set(j, { ...obj, [key]: ++obj[key]})
        } else {
          map.set(j, { ...obj, [key]: 1 })
        }
      }
    }
  }
  const result = map.get(level)[targetStr] || 0
  console.log(result);
  return result
}

countFZ(5,
  ["/huawei/computing/no/one",
    "/huawei/computing",
    "/huawei",
    "/huawei/cloud/no/one",
    "/huawei/wireless/no/one"],
  2, "computing")